package com.tanhua.server;

import com.tanhua.dubbo.api.BaiduServiceApi;
import com.tanhua.exception.BusinessException;
import com.tanhua.interceptor.UserHolder;
import com.tanhua.model.mongo.UserLocation;
import com.tanhua.model.vo.ErrorResult;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;

@Service
public class BaiduService {
    @DubboReference
    private BaiduServiceApi baiduServiceApi;

    //保存或更新地理位置
    public void updateOrSave(String longitude, String latitude, String address) {
        Long userId = UserHolder.getUserId();

        Boolean b = baiduServiceApi.updateOrSave(userId, longitude, latitude, address);
        if (!b) {
            throw new BusinessException(ErrorResult.error());
        }


    }
}
